package com.example.tuomin.controller;

import com.example.tuomin.entity.MyObj;
import com.example.tuomin.result.R;
import gov.jyy.xzxk.xksq.common.desensitization.EnableDesensitization;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.time.LocalDate;
import java.util.ArrayList;
import java.util.List;

/**
 * @className: TestController
 * @description: TODO 类描述
 * @author: liangshijie
 * @date: 2023/4/25
 **/
@RestController
public class TestController {

    @EnableDesensitization
    @GetMapping("a")
    public R<?> test() {
        return R.ok(getList());
    }

    @GetMapping("b")
    public R<?> te2st() {
        return R.ok(getList());
    }

    List<MyObj>  getList() {
        List<MyObj> result = new ArrayList<>();
//        result.add(MyObj.builder().sfz("450322197311184100").name("李小龙").age(null).build());
//        result.add(MyObj.builder().sfz("452128198107270523").name("皇非红").build());
        result.add(MyObj.builder().sfz("452122197507134229").name("皇非红").createdDate(LocalDate.now()).build());
        result.add(MyObj.builder().sfz("43292419680711501X").name("皇非红").build());
        result.add(MyObj.builder().sfz("123456789123888456787").name("皇非红").build());
        result.add(MyObj.builder().sfz("12x3888456787").name("皇非红").build());
//        result.add(MyObj.builder().sfz("320102198302040024").name("皇非红").build());
//        result.add(MyObj.builder().sfz("452501197411222742").name("皇非红").build());
//        result.add(MyObj.builder().sfz("450322198312263075").name("皇非红").build());
//        result.add(MyObj.builder().sfz("452331197605160313").name("皇非红").build());
//        result.add(MyObj.builder().sfz("440923198901053743").name("皇非红").build());
//        result.add(MyObj.builder().sfz("432925197110170044").name("皇非红").build());
        return result;
    }

    public  static  List<MyObj>  generate(int  num)  {
        List<MyObj>  list  =  new  ArrayList<>();
        for  (int  i  =  1;  i  <=  num;  i++)  {
            MyObj  obj  =  MyObj.builder()
                    .sfz("32098119900101"  +  String.format("%05d",  i))
                    .name("姓名"  +  i)
                    .build();
            list.add(obj);
        }
        return  list;
    }
}




